package com.dengdai.applibrary.widgets.progres;

import android.app.ProgressDialog;
import android.content.Context;
import android.os.Bundle;
import android.text.TextUtils;
import android.widget.TextView;

import com.dengdai.applibrary.config.ResIdName;
import com.dengdai.applibrary.utils.BaseViewUtils;

/**
 * @说明 自定义数据加载对话框
 * @作者 LY
 * @时间 16/5/5 10:25
 * @邮箱 2743569843@qq.com
 * @版权 Copyright(c) 2016 LY-版权所有
 * @备注
 */
public class CustomLoadingDialoge extends ProgressDialog {
    private TextView tvLoad;
    private String msg;
    private Context mContext;

    /**
     * 自定义对话框
     *
     * @param context
     * @param msg     消息
     */
    public CustomLoadingDialoge(Context context, String msg) {
        super(context, BaseViewUtils.gainResId(context, BaseViewUtils.STYLE, ResIdName.CUSTOMPROGRESSDIALOGSTYPE));
        this.msg = msg;
        this.mContext = context;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(BaseViewUtils.gainResId(mContext, BaseViewUtils.LAYOUT, ResIdName.CUSTOMPROGRESSDIALOGVIEW));
        tvLoad = (TextView) findViewById(BaseViewUtils.gainResId(mContext, BaseViewUtils.ID, ResIdName.TVLOAD));
        if (!TextUtils.isEmpty(msg))
            tvLoad.setText(msg);
        setCancelable(false);
    }
}
